/**
 * 角色拦截器
 */
import http from "@/api/http";

export class RoleService {
    /**
     * 获取角色列表
     * @returns {Promise<AxiosResponse<any>>}
     * @constructor
     */
    static GetRoleList() {
        return http({
            url: '/api/role/lists',
            method: 'get'
        })
    }

    /**
     * 添加菜单
     * @param query
     * @returns {Promise<AxiosResponse<any>>}
     * @constructor
     */
    static AddRole(query) {
        return http({
            url: '/api/role/add',
            data: query,
            method: 'post'
        })
    }

    /**
     * 获取角色信息
     * @param query
     * @returns {Promise<AxiosResponse<any>>}
     * @constructor
     */
    static GetRoleById(query) {
        return http({
            url: '/api/role/detail',
            data: query,
            method: 'post'
        })
    }

    /**
     * 修改角色信息
     * @param query
     * @returns {Promise<AxiosResponse<any>>}
     * @constructor
     */
    static ModifyRole(query) {
        return http({
            url: '/api/role/edit',
            data: query,
            method: 'post'
        })
    }

    /**
     * 角色分配权限
     * @param query
     * @returns {Promise<AxiosResponse<any>>}
     * @constructor
     */
    static GrantRoleMenus(query) {
        return http({
            url: '/api/role/grant_auth',
            data: query,
            method: 'post'
        })
    }

    /**
     * 获取角色权限
     * @param query
     * @returns {Promise<AxiosResponse<any>>}
     * @constructor
     */
    static GetRoleMenus(query) {
        return http({
            url: '/api/role/get_grant_auth',
            data: query,
            method: 'post'
        })
    }

    /**
     * 根据id删除角色
     * @param query
     * @returns {Promise<AxiosResponse<any>>}
     * @constructor
     */
    static DeleteRoleById(query){
        return http({
            url:'/api/role/del',
            data:query,
            method:'post'
        })
    }
}
